import request from '@/utils/request'
import qs from "qs";

export function findListByPage(params) {
  return request({
    url: 'api/script/test/task' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: 'api/script/test/task',
    method: 'post',
    data
  })
}

export function del(pkIds) {
  return request({
    url: 'api/script/test/task/' + pkIds,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: 'api/script/test/task',
    method: 'put',
    data
  })
}

export function toReTest(pkId) {
  return request({
    url: 'api/script/test/task/test/' + pkId,
    method: 'get'
  })
}

export function dataAlignment(pkId) {
  return request({
    url: 'api/script/test/task/data/alignment/' + pkId,
    method: 'get'
  })
}

export function dataSynchronize(pkId) {
  return request({
    url: 'api/script/test/task/data/sync/' + pkId,
    method: 'get'
  })
}

export function downloadScript(data) {
  return request({
    url: 'api/script/data/test/result/download/file',
    method: 'post',
    data,
    responseType: 'blob'
  })
}

export default { findListByPage, add, del, edit, toReTest, dataAlignment, downloadScript, dataSynchronize }
